#include "basis_sampler.h"


int main(int argc, char* argv[])
{
  cout << randomBasis(atoi(argv[1])) << endl;
}

mat_ZZ randomBasis(int dimension) 
{
  mat_ZZ ret; //thing to return
  vec_ZZ temp; 

  ZZ m = power_ZZ(2, RANDOM_MAX); //let m be 2^RANDOM_MAX
  ZZ z;
  z = 0;

  //set them both to be right dimension
  for(int i = 0; i < dimension; i++)
    append(temp, z); //appends a dimension number of 0's to vec_ZZ temp
  ret.SetDims(dimension, dimension); //set dimension for return matrix
  //initialize all to 0
  for(int i = 0; i < dimension; i++)
    for(int j = 0; j < dimension; j++)
      ret[i][j] = 0;

  //use seed s for RNG
  ZZ s;
  s = time(0);
  SetSeed(s);
  ret[0][0] = m; //set value at (0, 0) to be m
  //then, set rest of top row to be random numbers less than m
  for(int i = 1; i < dimension; i++)
    ret[i][0] = RandomBnd(m); 
  //now, set the diagonal to be 1
  for(int i = 1; i < dimension; i++)
    ret[i][i] = 1;
  
  //return this vector
  return ret;
}

